<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="#" method="get">
        <input type="text" value="请输入你的姓名">
        <select name="" id="">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
        </select>
        <input type="submit">
        <input type="reset">
    </form>

    <script>
        var input = document.querySelector('input');
        // input.onfocus = function(){
        //     console.log('获取焦点');
        // }

        // input.onblur = function(){
        //     console.log('失去焦点');
        // }

        // 上面经常用在表单注册信息的时候 
        // input.onchange = function(){
        //     console.log('内容改变');
        // }
        // var se = document.querySelector('select');
        // se.onchange = function(){
        //     console.log('内容改变');
        // }

        // var inputs = document.getElementsByTagName('input')[0];
        // inputs.oninput = function(){
        //     console.log('内容输入');
        // }

        var ss = document.getElementsByTagName('input')[1];
        ss.onsubmit = function(){
            console.log('提交');
        }

        // 上面写法没用 必须获取form
        var form = document.querySelector('form');
        form.onsubmit = function(){
            console.log('提交');
        }

        form.onreset = function(){
            console.log('重置');
        }

    </script>

</body>
</html>